package com.pactera.madp.cp.api.em.channel;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.pactera.madp.cp.api.em.contactfield.TypeEnum;
import lombok.*;

/**
 * ChannelCodeStatusEnum
 *
 * @author jun
 * @version 1.0
 * 2021/8/9 18:11
 **/
@AllArgsConstructor
@NoArgsConstructor
@Getter
public enum ChannelCodeStatusEnum {
    NORMAL(1,"正常"),
    DELETE(2,"流失"),
    BLACKLIST(3,"拉黑");

    private Integer code;
    private String msg;

    /**
     * 根据 code 值获取对应的msg
     * @param code
     * @return msg
     */
    public static String getTypeByCode(int code) {
        ChannelCodeStatusEnum[] values = values();
        for (ChannelCodeStatusEnum e : values) {
            if (e.getCode() == code) {
                return e.getMsg();
            }
        }
        return "";
    }
}
